/* 
  *	include/cos/interrupt.h
  *
  * 	created at 2007.10.01 by ChenJie
  *
  *	last modified at 2007.10.01
  *
  */
#ifndef INTERRUPT_H
#define INTERRUPT_H

#include <asm/i8259.h>

#define SYSCALL_VECTOR		(0x80)

#define HOOKS_PER_IRQ		(32)

struct irq_hook;

typedef long (*irq_handler)(struct irq_hook *);

struct irq_hook {
	struct irq_hook * next;	// point to the next hook
	long id;					// each hook has its id
	irq_handler handler;		// irq handler
	long	irq;					// irq number
	long pid;					// which pid register to the hook
};

struct irq_struct {
	struct irq_hook * irq_handle[NR_IRQ];
	struct irq_hook * free_irq_hook;
	struct irq_hook irq_hook[HOOKS_PER_IRQ * NR_IRQ];
};

void interrupt_init(void);

long irq_put_hook(int irq, irq_handler handler, int pid);

long irq_rm_hook(long id);

#endif
